#!/usr/bin/python3

import elemlib


a = ["cd-album", "game", "movie", "tv-show", "wallpaper"]

with elemlib.Library(system_library_or_user_library=False) as sysLib:
    print("- Synchronize metadata...")
    for etype in a:
        print("    - Type %s..." % (etype))
        sysLib.sync(etype)

    print("- Update cached elements...")
    for etype in a:
        for elem in sysLib.get_elements(etype, "*", "*"):
            print("    - Type: %s, Source: %s, Index: %s..." % (elem.etype, elem.esource, elem.eindex))
            cachedPartNameList = [x.pname for x in elem.get_parts() if x.get_local_path() is not None]
            elem.cache(cachedPartNameList)
